package net.oschina.app.viewpagerfragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yzq.testzxing.zxing.android.CaptureActivity;

import net.oschina.app.MApp;
import net.oschina.app.R;
import net.oschina.app.ui.EventsActivity;
import net.oschina.app.ui.FindPeopleActivity;
import net.oschina.app.ui.FriendCircleActivity;
import net.oschina.app.ui.view.ShakeActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by foty on 2017/4/1.
 * ?
 */

public class ExploreFragment extends Fragment {

    @BindView(R.id.tv_friend_circle)
    TextView mTvFriendCircle;
    @BindView(R.id.tv_find_people)
    TextView mTvFindPeople;
    @BindView(R.id.tv_activate)
    TextView mTvActvity;
    @BindView(R.id.tv_richscan)
    TextView mTvRichscan;
    @BindView(R.id.tv_shake)
    TextView mTvShake;
    private View mRootView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //根布局
        mRootView = inflater.inflate(R.layout.explore_view, container, false);
        ButterKnife.bind(this, mRootView);//绑定控件
        return mRootView;
    }

    //监听事件
    @OnClick({R.id.tv_friend_circle, R.id.tv_find_people, R.id.tv_activate, R.id.tv_richscan, R.id.tv_shake})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_friend_circle://好友圈按钮
                //跳转朋友圈页面
                Intent friendCircleIntent = new Intent(MApp.mContext, FriendCircleActivity.class);
                startActivity(friendCircleIntent);
                break;
            case R.id.tv_find_people://找人按钮
                //跳转找人页面
                Intent findPeopleIntent = new Intent(MApp.mContext, FindPeopleActivity.class);
                startActivity(findPeopleIntent);
                break;
            case R.id.tv_activate://活动按钮
                //跳转活动页面
                Intent activateIntent = new Intent(MApp.mContext, EventsActivity.class);
                startActivity(activateIntent);
                break;
            case R.id.tv_richscan://扫一扫按钮
                //跳转扫一扫页面
                Intent captureIntent = new Intent(MApp.mContext, CaptureActivity.class);
                startActivity(captureIntent);
                break;
            case R.id.tv_shake://摇一摇按钮
                Intent shakeIntent = new Intent(MApp.mContext, ShakeActivity.class);
                startActivity(shakeIntent);
                break;
        }
    }
}
